<?
	$hostname='localhost';
	$username='root';
	$password='';
	$database='dbsewavcd';

	$conn=mysql_connect($hostname, $username, $password) or die("Cann't Connect server");
	$eeek=mysql_select_db($database, $conn) or die("Cann't Connect database");

	if($kode_vcd==""||$judul_film==""||$harga_sewa==""||$stock==""){
	header ('Location: ../index.php');
	exit;
	}

	$a=mysql_query("select * from vcdrental where kode_vcd='$kode_vcd'");
	$b=mysql_num_rows($a);

	if($b==0){
	$new=mysql_query("insert into vcdrental values('$kode_vcd', '$judul_film','$harga_sewa','$stock')");
	}
	else{
	$upd=mysql_query("update vcdrental set judul_film='$judul_film', harga_sewa='$harga_sewa', stock='$stock' where kode_vcd='$kode_vcd'");
	}

	header ('Location: ../index.php');
?>